package main

import "fmt"

// 从一个数组中找到最大值,最小值,求平均值,求和
func main() {
	var number [5]int = [5]int{3, 6, 7, 8, 9}
	var maxOne int = number[0]
	var minOne int = number[0]
	var sum int = 0
	var avg = 0

	for _, v := range number {
		if maxOne <= v {
			maxOne = v
		}

		if minOne >= v {
			minOne = v
		}
		sum += v
	}

	avg = sum / len(number)

	fmt.Println("最小值:", minOne)
	fmt.Println("最大值:", maxOne)
	fmt.Println("总和:", sum)
	fmt.Println("平均值:", avg)
}
